package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId  int     `gorm:"type:tinyint;not null;comment:用户ID"`
	GoodsId int     `gorm:"type:tinyint;not null;comment:商品ID"`
	Num     int     `gorm:"int(5);not null;comment:订单数量"`
	OrderSn string  `gorm:"type:varchar(255);not null;comment:订单编号"`
	Amount  float64 `gorm:"decimal(10,2);not null;comment:总价"`
}

func (o *Order) Add() error {
	return DB.Create(&o).Error
}
